package com.mindshifter.pivotaltracker.services.v3.core
{
	import mx.utils.StringUtil;

	public class TrackerURLBuilder
	{
		
		public static const BASE_ADDRESS			:String = "http://www.pivotaltracker.com";
		public static const BASE_HTTPS_ADDRESS		:String = "https://www.pivotaltracker.com";
		public static const PROJECTS_URL			:String = "/services/v3/projects";
		public static function getTokenUrl():String
		{
			return BASE_HTTPS_ADDRESS + "/services/v3/tokens/active";
		}		
		public static function getAllProjectsUrl():String {
			return BASE_HTTPS_ADDRESS	+ PROJECTS_URL;
		}		
		public static function getProjectUrl(projectId:Number):String {
			return BASE_ADDRESS	+ StringUtil.substitute("/services/v3/projects/{0}", projectId);
		}		
		public static function getAllMemberships(projectId:Number):String {
			return BASE_ADDRESS	+ StringUtil.substitute("/services/v3/projects/{0}/memberships",projectId);
		}
		public static function getMembership(projectId:Number,membershipId:Number):String {
			return BASE_ADDRESS	+ StringUtil.substitute("/services/v3/projects/{0}/memberships/{1}",projectId,membershipId);
		}
		
		/*public static function getIterationsWithLimitAndOffset(projectId:Number,interationGroup:String = "",offset:Number,limit:Number):String {
			return BASE_ADDRESS	+ StringUtil.substitute("/services/v3/projects/{0}/iterations/{1}",projectId,interationGroup);
		}		
		public static function getIterations(projectId:Number,interationGroup:String = "",offset:Number,limit:Number):String {
			return BASE_ADDRESS	+ StringUtil.substitute("/services/v3/projects/{0}/iterations/{1}",projectId,interationGroup);
		}*/		
		public static function getStoriesUrl(projectId:Number):String {
			return BASE_ADDRESS + StringUtil.substitute("/services/v3/projects/{0}/stories", projectId);
		}		
		public static function getStoryUrl(projectId:Number,storyId:Number):String {
			return BASE_ADDRESS	+ StringUtil.substitute("/services/v3/projects/{0}/stories/{1}",	projectId, storyId);
		}
	}
}